# running Java experiments for Unified Repair project

from subprocess import Popen
import math
import time

f_out = open("output/out4.txt", 'w')

error = [[0, 80, 2], [10, 50, 5], [10, 30, 6], [10, 0, 7]]

n = 0
t0 = time.time()

#datadir = "D:/data/Census/schema D:/data/Census/fds D:/data/Census/data"
datadir = "C:/workspace/data/Census/schema C:/workspace/data/Census/fds C:/workspace/data/Census/data"

for rates in [error[3]]:
    print("data error = {0}, fd error = {1}".format(rates[0], rates[1]))
    
    for alpha in range(1, 10):
        print("\talpha = ", alpha)
        
        for beta in [math.floor(x / rates[2] * 100) for x in range(1, rates[2])]:
            print("\t\tbeta = ", beta)
            
            Popen("java -jar C:/workspace/FD_Tune_New/fei.jar " + datadir + " 5000 , {1} {2} {0[1]} {0[0]}"
                  .format(rates, alpha, beta), stdout=f_out).wait()
            
            n += 1
            elapsed = (time.time()-t0);
            print("\t\t{0} done, Elapsed = {1:.1f} sec, Average = {2:.1f} sec/run"
                  .format(n, elapsed, elapsed/n))


f_out.close();